home *** CD-ROM | disk | FTP | other *** search
/ Shareware Extravaganza - Disc 1 / ShareWare Extravaganza 1 of 4 (The Ultimate Shareware Company).iso / sblaster / gb2f.zip / GB2FIX.C next >
C/C++ Source or Header  |  1990-07-06  |  2KB  |  89 lines

  1. /*
  2.     program to patch Activision's GHOSTBUSTERS II
  3.     to work with Creative Labs SOUNDBLASTER card
  4.  
  5.     If your system locks up after outputting a digitized
  6.     voice, try this quick fix.  If this doesn't do it,
  7.     call Creative Labs for a patch disk.
  8.  
  9.     John Hayes
  10.     1094 Berkshire Drive
  11.     Macedonia, Ohio  44056-1643
  12.     CompuServe 73447,3515
  13.  
  14.     Compiled with Microsoft C - Version 5.1
  15. */
  16.  
  17. #include <stdio.h>
  18.  
  19. main()
  20. {
  21.     FILE    *fd;
  22.     int    ch;
  23.     long    remember;
  24.  
  25. /*
  26.     open GB.EXE for read/write
  27. */
  28.     if ((fd=fopen("gb.exe","r+b")) == NULL) {
  29.         perror("unable to open GB.EXE for modification");
  30.         exit(-1);
  31.         }
  32.  
  33. /*
  34.     find the binary string 75 fc 5d cb
  35.     and replace "fc" with "f8"
  36. */
  37.     while ((ch = getc(fd)) != EOF) {
  38.         if (ch == 0x75) {
  39.             remember = ftell(fd);
  40.             ch = getc(fd);
  41.             if (ch == 0xfc) {
  42.                 ch = getc(fd);
  43.                 if (ch == 0x5d) {
  44.                     ch = getc(fd);
  45.                     if (ch == 0xcb) {
  46.                         fseek(fd,remember,SEEK_SET);
  47.                         putc(0xf8,fd);
  48.                         puts("GB.EXE patched");
  49.                         break;
  50.                     }
  51.                 }
  52.             }
  53.         }
  54.     }
  55.     fclose(fd);
  56.  
  57. /*
  58.     open SHELL.EXE for read/write
  59. */
  60.     if ((fd=fopen("shell.exe","r+b")) == NULL) {
  61.         perror("unable to open SHELL.EXE for modification");
  62.         exit(-1);
  63.         }
  64.  
  65. /*
  66.     find the binary string 75 fc 5d cb
  67.     and replace "fc" with "f8"
  68. */
  69.     while ((ch = getc(fd)) != EOF) {
  70.         if (ch == 0x75) {
  71.             remember = ftell(fd);
  72.             ch = getc(fd);
  73.             if (ch == 0xfc) {
  74.                 ch = getc(fd);
  75.                 if (ch == 0x5d) {
  76.                     ch = getc(fd);
  77.                     if (ch == 0xcb) {
  78.                         fseek(fd,remember,SEEK_SET);
  79.                         putc(0xf8,fd);
  80.                         puts("SHELL.EXE patched");
  81.                         break;
  82.                     }
  83.                 }
  84.             }
  85.         }
  86.     }
  87.     fclose(fd);
  88. }
  89.